{% extends "base.html" %}
{% load i18n %}
<body>
{% block detail %}
    <div class="main">
        <div class="ucWrap">
            <div class="ucSide">
                <h2>{% trans 'Accounts' %}</h2>
                <ul>
                    <li class="cur"><a href="#">&gt; {% trans 'Browsed Cases' %}</a></li>
                    <li><a href="/my/favor/">&gt; {% trans 'Saved Cases' %}</a></li>
                    <li><a href="/my/case/">&gt; {% trans 'My Cases' %}</a></li>
                    <li><a href="/my/setting/">&gt; {% trans 'Account' %}</a></li>
                    <li><a href="/my/password/change/">&gt; {% trans 'Change password' %}</a></li>
                </ul>
            </div>
            <div class="ucMain">
                <h2><span><b>{% trans 'Browsed Cases' %}</b></span></h2>
                <ul id="browse">

                </ul>
                <div id="pager"></div>
            </div>
        </div>
    </div>
    <input type="hidden" value="{{ pageCount }}" id="pageCount"/>
    <input type="hidden" value="{{ totalCount }}" id="totalCount"/>
{% endblock %}
{% block js %}
    <script type="text/javascript" src="/assets/js/jquery.pager.js"></script>
    <script type="text/javascript">
        //默认加载
        function init(pagenumber) {
            // var data = {'pagecount':9, 'totalcount':90};
            var pageCount = $("#pageCount").val();
            var totalCount = $("#totalCount").val();
            if (null != pageCount && null != totalCount && '' != pageCount && '' != totalCount && totalCount > 0) {
                {% ifequal LANGUAGE_CODE 'zh-cn' %}
                    $("#pager").pager({lang: 'zh-cn', pagenumber: pagenumber, pagecount: pageCount, totalcount: totalCount, buttonClickCallback: PageClick});
                {% else %}
                    $("#pager").pager({lang: 'en', pagenumber: pagenumber, pagecount: pageCount, totalcount: totalCount, buttonClickCallback: PageClick});
                {% endifequal %}
            }
        }

        var PageClick = function (pageclickednumber) {
            queryPersonalBrowse(pageclickednumber);
            init(pageclickednumber);
        };
        $(function () {
            init(1);
            queryPersonalBrowse(1);
        });
        function queryPersonalBrowse(pagenumber) {
            $.ajax({
                url: '/personalPage/',
                data: "pagenumber=" + pagenumber,
                type: 'get',
                dataType: 'html',
                success: function (data) {
                    if (data != null && data != '') {
                        var obj = $("#browse");
                        $("#browse li").remove();
                        obj.append(data);
                    }
                }
            });
        }
    </script>
{% endblock %}
</body>